using GoodDotNet.Core.Data;
using GoodDotNet.Core.Entity;

namespace GoodDotNet.Service
{
    public class userService
    {
		UnitOfWork _unitOfWork;
		public userService(UnitOfWork unitOfWork)
		{
		   _unitOfWork = unitOfWork;
		}
    
		
		
		/// @author 大钊
		/// @since 2023/9/15 18:35:31
		/// <summary>
		/// 统计用户数
		/// </summary>
		/// <returns></returns>
		public int ApiCount()
		{
		  
		  var count=_unitOfWork.UserRepository.Count();
		  
		  return count;
		}
		
		


		
		/// <summary>
		/// 修改用户
		/// </summary>
		/// <returns></returns>
		public void UpdateGrade(UserUpdateGradeParModel pars)
		{
		  
			User entity=_unitOfWork.UserRepository.Get(a=>a.Id==pars.Id);
			
		  entity.Grade=pars.Grade;
		  _unitOfWork.UserRepository.Update(entity);
		  _unitOfWork.SaveChanges();
		
		}
		
		
		

}
}